{include file=header.html}
        <link href="{lib file=jquery.ui.1.10.2/css/ui-lightness/jquery-ui-1.10.2.custom.css}" rel="stylesheet">
       <script type="text/javascript" language="javascript" src="{lib file=jquery-1.6.3.min.js}"></script>
       <script language="javascript" type="text/javascript" src="{lib file=jquery.ui.1.10.2/js/jquery-ui-1.10.2.custom.js}"></script>
		<script language="javascript" type="text/javascript" src="{res file=js/factory_quote.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
        <script language="javascript" type="text/javascript" src="{lib file=ajaxfileupload.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
        <link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
        <script language="javascript" type="text/javascript" src="{res file=js/select.js}"></script>
       	<script language="javascript" type="text/javascript" src="{res file=DatePicker/WdatePicker.js}"></script>
        <style>
            label.error {color:red;}
			.center {text-align:center;}
			tr.fabric_info_list td input{width:100%;height:100%;}
			.btn-2{margin-bottom:5px;}
			input{margin-right:5px;}
            .input-1 {line-height:18px;width:158px;}
			 .select-1 {line-height:18px;width:160px;}

        </style>
    </head>
<script type="text/javascript">
$(function(){
	//删除报价信息
	$('a.quote_drop').click(function(){
		if(confirm('您确定要删除此工厂的报价吗?')){
			var _th=$(this);
			var qid=$(this).attr('qid');
			$.ajax({
				url:'index.php?app=quote&act=drop&qid='+qid,
				type:'get',
				dataType:'json',
				error:function(){
					alert('网络连接错误，请稍后再试');
				},
				success:function(data){
					if(data.flag){
						alert(data.msg);
						_th.parent().parent().remove();
					}else{
						alert(data.msg);
					}
				}
			});
		}else{
			return false;
		}
	});
});
function assign_factory(){
	var url="index.php?app=quote&act=assign_factory&{if $is_order}order_id={$order.order_id}{else}sample_id={$order.sample_id}{/if}";
	location.href=url;
}
</script>
<body>
<div class="sub-body" >
	<h3 class="title-1" style="width:600px;"><span>报价信息</span></h3>
    <div class="tab-frame">
		<form method="post" name="order_add_form" id="order_add_form" onsubmit="return check_create_order()" style="width:600px;">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
            	<th align="right" width="20%">报价日期：</th>
            	<td align="left">{$order.quote_time|date:Y-m-d}</td>
            </tr>
            </tr>
            <tr>
            	<th align="right" width="20%">报价编号：</th>
            	<td align="left">{$order.quote_sn|escape}&nbsp;&nbsp;<input type="button" value="分配工厂" class="btn-1" onclick="assign_factory()" {if $is_view}disabled="disabled"{/if} /></td>
            </tr>
            <!-- {if $is_order} -->
            <tr>
            	<th align="right" width="20%">订单号：</th>
            	<td align="left">{$order.order_sn|escape}</td>
            </tr>
            <tr>
            	<th align="right" width="20%">款号：</th>
            	<td align="left">{$order.style_sn}</td>
            </tr>
            <!-- {else} -->
            <tr>
            	<th align="right" width="20%">板号：</th>
            	<td align="left">{$order.sample_sn|escape}</td>
            </tr>
            <!-- {/if} -->
        	<tr>
            	<th align="right" width="20%">款式：</th>
            	<td align="left"><select name="info[style_id]" id="style_id" class="select-1" disabled="disabled">
					<option value="0">{$lang.select_pls}</option>
					<!--{foreach from=$style_list item=style key=k}-->
					<option value="{$style.style_id}"{if $order.style_id == $style.style_id} selected{/if} >{$style.style_name}</option>
					<!--{/foreach}-->
				</select></td>
            </tr>
            <tr>
            	<th align="right" width="20%">跟单：</th>
            	<td align="left">{$order.merchandiser}</td>
            </tr>
			<tr>
            	<th align="right" width="20%">件数：</th>
            	<!-- {if $is_order || $is_view} -->
            	<td align="left">{$order.quantity|default:0}</td>
            	<!-- {else} -->
            	<td align="left"><input name="quantity" type="text" value="{$order.quantity|default:0}" {if $order.quote_status==2}readonly="readonly"{/if} /></td>
            	<!-- {/if} -->
            </tr>
            <tr>
            	<th align="right" width="20%">货期：</th>
            	<td align="left"><input class="input-1" type="text" name="quote_check_date" id="quote_check_date" value="<!-- {if $order.quote_check_date} -->{$order.quote_check_date|date}<!-- {/if} -->" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" {if $order.quote_status==2 || $is_view} disabled="disabled"{/if} /></td>
            </tr>
            <tr>
            	<th align="right" width="20%">报价资料：</th>
            	<td align="left">
            		<div id="factory_quote_info">
            			<input  type="button" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_factory_quote},{if $is_order}{$order.order_id}{else}{$order.sample_id}{/if});" {if $order.quote_status==2 || $is_view} disabled="disabled"{/if} />
		                <!--{foreach from=$order.file_quote item=file}-->
						<span><a href="download.php?id={$file.file_id}" >{$file.file_name}</a>
							<!-- {if $user.role==USER_MERCHANDISER && ($order.quote_status!=2 || $is_view)} -->
		               		<a class="pic_del" href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>
		               		<!-- {/if} -->
		                </span>
						&nbsp;&nbsp;<!--{if !$smarty.foreach.last}--><!--{/if}--><!--{/foreach}-->
	                </div>
            	</td>
            </tr>
            <tr>
            	<th align="right" width="20%">细节图：</th>
            	<td align="left">
            		<input type="button" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_quote_thumb_img},{if $is_order}{$order.order_id}{else}{$order.sample_id}{/if});" {if $order.quote_status==2 || $is_view} disabled="disabled"{/if} />
            			<div id="quote_thumb_img">
            			<!-- {if $order.quote_thumb_img} -->
			      		<!-- {foreach from=$order.quote_thumb_img item=file} -->
			      			<span>
			      				<a href="download.php?id={$file.file_id}" ><img src="{$file.file_path}" alt="{$file.file_name}" title="{$file.file_name}" width="80px" height="60px" /></a>
			      				<!-- {if $user.role==USER_MERCHANDISER && ($order.quote_status!=2 || $is_view)} -->
			               		<a class="pic_del" href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>
			               		<!-- {/if} -->
			                </span>
							&nbsp;&nbsp;<!--{if !$smarty.foreach.last}--><!--{/if}--><!--{/foreach}-->
						<!-- {/if} -->
						</div>
            	</td>
            </tr>
            <tr>
				<td colspan="2" align="center">
				<!-- {if !$is_view} -->
				<!-- {if $user.role==USER_MERCHANDISER && $order.quote_status!=2} -->
				 <input type="submit" name="sub_val" value="提交审批" id="submit" class="btn-2" onclick="if(confirm('您确定提交审批吗？提交后将不能再更改！')!=true){return false;}" />
                 <!-- {/if} -->
                 <!-- {if ($user.role==USER_MERCHANDISER_ADMIN || $user.role==USER_MANAGER) && $order.quote_status==1} -->
                  <input type="submit" name="sub_val" value="审批通过" id="submit" class="btn-2" onclick="if(confirm('您确定审批通过吗？')!=true){return false;}" />
                 <!-- {/if} -->
                 <!-- {/if} -->
                 <input type="button" class="btn-2" value="返回" onclick="history.back();" />
				</td>
			</tr>
		</table>
		</form>
		<div style="width:600px;">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="quote_info_data">
		       	<tr>
		       		<th width="10%">用户</th>
		       		<th width="10%">报价</th>
		       		<th width="10%">报价单</th>
		       		<th width="10%">操作</th>
		       	</tr>
		       	<!-- {if $user.role==USER_MERCHANDISER || $user.role==USER_MANAGER || $user.role==USER_MERCHANDISER_ADMIN} -->
		       	<tr class="quote_info_list center" id="quote_info_list">
		       		<td>
		       			<select style="width:95%; height:20px;" name="member_name" item="member_name" data-placeholder="请选择" class="chzn-select">
				          <option value="0" >未选择</option>
				        <!--{foreach from=$factory_list item=member}-->
						  <option value="{$member.factory_id}">{$member.factory_name}</option>
				        <!--{/foreach}-->
				        </select>
		       		</td>
		       		<td><input name="quote_price" item="quote_price" value="" type="text" size="10"/></td>
		       		<td><input item="quote_order_file" type="button" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_quote_order}, {$default_cust_id});" {if $factory_role}disabled{/if} />
		       			<div id="quote_order_file" item="quote_file">
		       				<input name="quote_order_id" item="quote_file_id" type="hidden" />
		       			</div>
		       		</td>
		       		<td><input type="button" item="order_quote" class="btn-2" value="添加" <!-- {if $is_order} -->oid="{$order.order_id}"<!-- {else} -->sid="{$order.sample_id}"<!-- {/if} --> /></td>
		       	</tr>
		       	<!-- {/if} -->
		       	<!-- {foreach from=$quote_list item=quote} -->
		       	<tr class="quote_info_list center">
		       		<td>
		       			{$quote.factory_name}
		       		</td>
		       		<td>{$quote.quote_price}</td>
		       		<td>
		       			<div id="quote_order_file">
		       				<!-- {foreach from=$quote.file_quote item=file} -->
		       				<span><a href="download.php?id={$file.file_id}" >{$file.file_name}</a>
								&nbsp;&nbsp;<!--{if !$smarty.foreach.last}--></span><!--{/if}-->
								<br/>
		       				<!-- {/foreach} -->
		       			</div>
		       		</td>
		       		<td>
		       			<a href="javascript:void();" class="quote_drop" qid="{$quote.quote_id}">{$lang.delete}</a>
		       		</td>
		       	</tr>
		       	<!-- {/foreach} -->
		    	<tr>
		    		<td colspan="4"><div class="page">{include file=page.html}</div></td>
		    	</tr>
			</table>
		</div>
	</div>
</div>
<script type="text/javascript" language="javascript" src="{res file=js/tab_color.js}"></script>
</body>
{$async_sendmail}
</html>